﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CoreEx.Common.Extensions
{
    public static class StringBuilderExtensions
    {
        public static void AppendFormat(this StringBuilder stringBuilder, int indentLevel,string format,params object[] arguments)
        {
            for (int i = 0; i < indentLevel; i++)
            {
                stringBuilder.Append("\t");
            }
            stringBuilder.AppendFormat(format, arguments);
        }

        public static void AppendLine(this StringBuilder stringBuilder, int indentLevel,string format,params object[] arguments)
        {
            AppendFormat(stringBuilder,indentLevel,format,arguments);
            stringBuilder.AppendLine();
        }

        public static void AppendLine(this StringBuilder stringBuilder, int indentLevel, string value)
        {
            for (int i = 0; i < indentLevel; i++)
            {
                stringBuilder.Append("\t");
            }            
            stringBuilder.AppendLine(value);
        }
    }
}
